const mongoose = require('mongoose')

const Schema = mongoose.Schema

const userSchema = new Schema({
  email: {
    type: String,
    unique: true,
    required: true
  },
  username: {
    type: String,
    required: true
  },
  password: {
    type: String,
    required: true
  },
  ctime: {
    type: Date,
    default: Date.now
  },
  last_modify_time: {
    type: Date,
    default: Date.now
  },
  avatar: {
    type: String,
    default: 'https://timgsa.baidu.com/timg?image&quality=80&size=b9999_10000&sec=1583234976906&di=d07e34b2bd96ad50c0c028bafc10f39c&imgtype=0&src=http%3A%2F%2F01.minipic.eastday.com%2F20170724%2F20170724135534_d0593a6cacf0379e252a775cd9bd1e8e_4.jpeg'
  },
  gender: {
    type: Number,
    enum: [1, 2]
  },
  constellation: {
    type: String,
    default: '白羊座'
  },
  profession: {
    type: String,
    default: '学生'
  }
})

module.exports = mongoose.model('User', userSchema)
